package com.lv.phuotbacnam.ui.fragment;




import java.util.Timer;
import java.util.TimerTask;

import com.lv.phuotbacnam.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;


public class baocaosuco extends Activity  {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.baocaosuco);
		
	
		
	}
	// khi click button gui se hien messagebox hoi ban co muon gui hay ko
	public void click(View view) {
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
	    builder
	    .setTitle("Báo cáo sự cố")
	    .setMessage("Bạn chắc chắn gửi?")
	    .setIcon(android.R.drawable.ic_dialog_alert)
	    // click no se huy thao tac
	    .setPositiveButton("No", new DialogInterface.OnClickListener() 
	    {
	        public void onClick(DialogInterface dialog, int which) 
	        {      
	        	dialog.dismiss(); 
	               //do some thing here which you need
	    }
	    });  
	    // click yes se hien thong bao " chúng tôi sẽ phản hồi"
	    builder.setNegativeButton("Yes", new DialogInterface.OnClickListener() 
	    {
	    	// todo xu ly su kien gui phan hoi len server
	        public void onClick(DialogInterface dialog, int which) 
	        {   
	        	
	        	AlertDialog.Builder builde = new AlertDialog.Builder(baocaosuco.this);
	    	    builde
	    	    .setTitle("Chúng tôi sẽ sớm phản hồi về sự cố của bạn")
	    	    
	    	    ;   
	    	    final AlertDialog alert = builde.create();
		        alert.show();
		        // thoi gian hien thogn bao la 2s
		        final Timer t = new Timer();
                t.schedule(new TimerTask() {
                    public void run() {
                        alert.dismiss(); // when the task active then close the dialog
                        t.cancel(); // also just top the timer thread, otherwise, you may receive a crash report
                    }
                }, 2000);
		       
	        }
	    });         
	AlertDialog alert = builder.create();
	        alert.show();
	   
	 }
	

}
